//
//  MIXVisitorView.m
//  WEIBO
//
//  Created by Mix on 16/5/15.
//  Copyright © 2016年 Mix. All rights reserved.
//

#import "MIXVisitorView.h"

@interface MIXVisitorView ()

///小房子
@property(nonatomic,strong)UIImageView * homeView;

///转轮
@property(nonatomic,strong)UIImageView * iconView;

///消息lable
@property(nonatomic,strong)UILabel * messageLable;

///注册按钮
@property(nonatomic,strong)UIButton * registerButton;

///登陆按钮
@property(nonatomic,strong)UIButton * loginButton;

@end

@implementation MIXVisitorView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        //添加子控件
//        [self prepareUI];
        [self addSubview:self.homeView];
        [self addSubview:self.iconView];
        [self addSubview:self.messageLable];
        [self addSubview:self.registerButton];
        [self addSubview:self.loginButton];
    }
    return self;
}


-(void)prepareUI {
    [self addSubview:self.homeView];
    [self addSubview:self.iconView];
    [self addSubview:self.messageLable];
    [self addSubview:self.registerButton];
    [self addSubview:self.loginButton];
}

//布局子控件
-(void)layoutSubviews {
    [super layoutSubviews];
    
//    [self.homeView mas_makeConstraints:^(MASConstraintMaker *make) {
//        
//    }];
//    NSLayoutConstraint * layout = [NSLayoutConstraint constraintWithItem:self.homeView attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeCenterX multiplier:1 constant:0];
//    [self addConstraint:[NSLayoutConstraint constraintWithItem:self.homeView attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeCenterX multiplier:1 constant:0]];
//    [self addConstraint:[NSLayoutConstraint constraintWithItem:self.homeView attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeCenterY multiplier:1 constant:0]];
    
}





#pragma mark -- Getter && Setter

//小房子
-(UIImageView *)homeView {
    
    if (!_homeView) {
        _homeView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"visitordiscover_feed_image_house"]];
    }
    return _homeView;
}

//转轮
-(UIImageView *)iconView {
    
    if (!_iconView) {
        _iconView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"visitordiscover_feed_image_smallicon"]];
    }
    return _iconView;
}

//消息lable
-(UILabel *)messageLable {
    
    if (!_messageLable) {
        _messageLable = [[UILabel alloc] init];
        _messageLable.text = @"关注一些人,看看有什么惊喜!";
        _messageLable.textColor = [UIColor blackColor];
        _messageLable.numberOfLines = 0;
        _messageLable.font = [UIFont systemFontOfSize:16];
        [_messageLable sizeToFit];
    }
    return _messageLable;
}

//注册按钮
-(UIButton *)registerButton {
    
    if (!_registerButton) {
        _registerButton = [[UIButton alloc] init];
        [_registerButton setTitle:@"注册" forState:UIControlStateNormal];
        [_registerButton setTitleColor:[UIColor orangeColor] forState:UIControlStateNormal];
        [_registerButton setBackgroundImage:[UIImage imageNamed:@"common_button_white_disable"] forState:UIControlStateNormal];
    }
    return _registerButton;
}

//登陆按钮
-(UIButton *)loginButton {
    
    if (!_loginButton) {
        _loginButton = [[UIButton alloc] init];
        [_loginButton setTitle:@"登陆" forState:UIControlStateNormal];
        [_loginButton setBackgroundImage:[UIImage imageNamed:@"common_button_white_disable"] forState:UIControlStateNormal];
        [_loginButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    }
    return _loginButton;
}

@end




